<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<fmt:bundle
	basename="br.com.universidade.castelo.branco.resources.ApplicationResources"
	prefix="">
<head>

	<link rel="stylesheet" type="text/css" href="resources/js/jquery/apprise.css" />
	<script src="resources/js/jquery/jquery-1.4.4.min.js"></script>
	<script src="resources/js/jquery/apprise-1.5.full.js"></script>
	
	<link rel="stylesheet" href="resources/js/jquery/jquery-ui.css" />
	<script src="resources/js/jquery/jquery-1.9.1.js"></script> 
	<script src="resources/js/jquery/jquery-ui.js"></script>
	
<script type="text/javascript">

function chamaExcluirPergunta(id_pergunta){
$(function() {
    $( "#dialog-confirmaExclusao" ).dialog({
      resizable: false,
      height:140,
      modal: true,
      buttons: {
        "OK": function() {
        	$( this ).dialog( "close" );
        	excluirPergunta(id_pergunta);
        },
        "Cancelar": function() {
          $( this ).dialog( "close" );
        }
      }
    });
  });
}  
  
function excluirPergunta(id_pergunta){
		$.ajax({	
	        type: 'POST',  
	        url: 'excluiPergunta?id_pergunta=' + id_pergunta,  
	        success: function() {
	        	perguntaExcluida();
	        }
	    });
}

function perguntaExcluida(){
	window.location.href='perguntaExcluida';
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="resources/css/formatos.css" />
</head>
	<body>
		<jsp:include page="/WEB-INF/views/pesquisadesatisfacao/menu.jsp"
			flush="true"></jsp:include>

		<img src="resources/imagens/pixel_transparente.gif" height="5%"
			width="10%">
			
		<div align="center">

		<fieldset id="fieldsetConsulta">

			<legend id="alinhamentoFormConsulta">
				<h3>
					<fmt:message key="consulta.modulo.pergunta.titulo"></fmt:message>
				</h3>
			</legend>

			
				<table class=linhasAlternadas align="center">

					<tr>
						<th><fmt:message key="consulta.modulo.pergunta.campo.descricao"></fmt:message></th>
						<th><fmt:message key="consulta.modulo.pergunta.campo.peso"></fmt:message></th>
						<th><fmt:message key="consulta.modulo.pergunta.campo.alterar"></fmt:message></th>
						<th><fmt:message key="consulta.modulo.pergunta.campo.excluir"></fmt:message></th>
					</tr>

					<c:forEach items="${perguntas}" var="pergunta">
						<tr>
							<td>${pergunta.descricao}</td>
							<td>${pergunta.peso}</td>
							<td><a href="exibePergunta?id_pergunta=${pergunta.id_pergunta}"><div class=imgAlterar></div></a></td>
							<td><a href="javascript:void(0)" onclick="chamaExcluirPergunta(${pergunta.id_pergunta})"><div class=imgExcluir></div></a></td>
						</tr>
					</c:forEach>
				</table>
				<table>
				<tr>
					<td>
						<br />
					</td>
				</tr>
				</table>
		</fieldset>
		<table>
				<tr> 
					<td>  <div id="dialog-confirmaExclusao" title="Excluir" style="display: none;">
						<p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 1px 0;"></span><fmt:message key="pds.excluir"></fmt:message></p>
					</div>
					</td> 
				</tr> 
		</table>
		</div>
	</body>
</fmt:bundle>
</html>